package bootstrap

import (
	"log"

	"github.com/amitshekhariitbhu/go-backend-clean-architecture/kafka"
	"github.com/amitshekhariitbhu/go-backend-clean-architecture/mongo"
)

type Application struct {
	Env   *Env
	Mongo mongo.Client
	Kafka *kafka.Config
}

func App() Application {
	app := &Application{}
	app.Env = NewEnv()
	app.Mongo = NewMongoDatabase(app.Env)
	app.Kafka = NewKafkaConfig(app.Env)

	// Add verification logging
	log.Printf("Kafka configuration loaded: Brokers=%v, Topic=%s",
		app.Kafka.Brokers, app.Kafka.Topic)

	return *app
}

func (app *Application) CloseDBConnection() {
	CloseMongoDBConnection(app.Mongo)
}
func (app *Application) CloseKafkaConnection() {
	// CloseKafkaConnection(app.Kafka)
}
